home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5255 < prev    next >
Encoding:
Text File  |  1996-08-06  |  882 b   |  31 lines

  1. Path: locutus.rchland.ibm.com!usenet
  2. From: pstaite@vnet.ibm.com
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Argument from commandline???
  5. Date: 2 Feb 1996 15:31:37 GMT
  6. Organization: IBM OS/2 Device Driver Development  Rochester, MN
  7. Message-ID: <4etaop$ilm@locutus.rchland.ibm.com>
  8. References: <4eou36$p6g@prometheus.algonet.se>
  9. Reply-To: pstaite@vnet.ibm.com
  10. NNTP-Posting-Host: warpone.rchland.ibm.com
  11. X-Newsreader: IBM NewsReader/2 v1.2
  12.  
  13. In <4eou36$p6g@prometheus.algonet.se>, bifrost@algonet.se (Nylund Patrik) writes:
  14. >How do I include argument from the commandline to the main function in
  15. >a c++ program?
  16.  
  17. Same as in C:
  18.  
  19.  
  20. #include<iostream.h>
  21.  
  22. int main( int argc, char* argv[] ) {
  23.     for( int i = 0 ; i < argc ; ++i )
  24.         cout << "Argument " << i << " is " << argv[ i ] << endl;
  25.     return 0; }
  26.  
  27.  
  28. Phil Staite, team OS/2
  29. internet: pstaite@vnet.ibm.com  internal: pstaite@rchland
  30.  
  31.